package com.hangjiang.gulidear.model;

import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * Code entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "code", catalog = "sqm")
public class Code extends BaseEntity {

	// Fields

	private String codeId;
	private Project project;
	private User user;
	private String codeTitle;
	private Timestamp submitTime;
	private String describe;
	private String version;
	private String attachPath;

	// Constructors

	/** default constructor */
	public Code() {
	}

	/** full constructor */
	public Code(Project project, User user, String codeTitle,
			Timestamp submitTime, String describe, String version,
			String attachPath) {
		this.project = project;
		this.user = user;
		this.codeTitle = codeTitle;
		this.submitTime = submitTime;
		this.describe = describe;
		this.version = version;
		this.attachPath = attachPath;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "codeId", unique = true, nullable = false, length = 32)
	public String getCodeId() {
		return this.codeId;
	}

	public void setCodeId(String codeId) {
		this.codeId = codeId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "projId")
	public Project getProject() {
		return this.project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "codeTitle", length = 30)
	public String getCodeTitle() {
		return this.codeTitle;
	}

	public void setCodeTitle(String codeTitle) {
		this.codeTitle = codeTitle;
	}

	@Column(name = "submitTime", length = 0)
	public Timestamp getSubmitTime() {
		return this.submitTime;
	}

	public void setSubmitTime(Timestamp submitTime) {
		this.submitTime = submitTime;
	}

	@Column(name = "describe", length = 200)
	public String getDescribe() {
		return this.describe;
	}

	public void setDescribe(String describe) {
		this.describe = describe;
	}

	@Column(name = "version", length = 8)
	public String getVersion() {
		return this.version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	@Column(name = "attachPath")
	public String getAttachPath() {
		return this.attachPath;
	}

	public void setAttachPath(String attachPath) {
		this.attachPath = attachPath;
	}

}